package gui;

import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JSeparator;
import javax.swing.JTextField;
import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.SwingConstants;
import javax.swing.border.TitledBorder;

public class TelaLogin extends JFrame {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	private JPanel contentPane;
	private JTextField textField;
	private JPasswordField textField_1;
	private JTextField textField_2;

	/**
	 * Create the frame.
	 */
	public TelaLogin() {
		setUndecorated(true);
		setResizable(false);
		initialize();
	}

	private void initialize(){
		
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 400, 250);
		setLocationRelativeTo(null);
		contentPane = new JPanel();
		contentPane.setBorder(new TitledBorder(null, "", TitledBorder.LEADING, TitledBorder.TOP, null, null));
		setContentPane(contentPane);
		contentPane.setLayout(new BorderLayout(0, 0));
		
		JPanel panel_4 = new JPanel();
		contentPane.add(panel_4, BorderLayout.CENTER);
		
		JButton button = new JButton("");
		button.setToolTipText("Fechar.");
		button.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				System.exit(0);
			}
		});
		button.setIcon(new ImageIcon(TelaLogin.class.getResource("/img/delete_16.png")));
		
		JLabel lblAtosProcessuais = new JLabel("");
		lblAtosProcessuais.setIcon(new ImageIcon(TelaLogin.class.getResource("/img/logo_tempus_login.png")));
		lblAtosProcessuais.setFont(new Font("SansSerif", Font.BOLD, 24));
		
		JSeparator separator = new JSeparator();
		
		JLabel lblEndereoDoServidor = new JLabel("Endere\u00E7o do Servidor:");
		lblEndereoDoServidor.setIcon(new ImageIcon(TelaLogin.class.getResource("/img/network_32.png")));
		
		textField = new JTextField();
		textField.setToolTipText("Digite o nome do servidor.");
		textField.setColumns(10);
		
		JLabel lblLogin = new JLabel("Login:");
		lblLogin.setIcon(new ImageIcon(TelaLogin.class.getResource("/img/user_32.png")));
		
		JLabel lblSenha = new JLabel("Senha:");
		lblSenha.setIcon(new ImageIcon(TelaLogin.class.getResource("/img/key_32.png")));
		
		textField_1 = new JPasswordField();
		textField_1.setToolTipText("Digite sua senha.");
		textField_1.setColumns(10);
		
		textField_2 = new JTextField();
		textField_2.setToolTipText("Digite seu nome de usu\u00E1rio.");
		textField_2.setColumns(10);
		
		JCheckBox chckbxLembrar = new JCheckBox("Lembrar");
		chckbxLembrar.setToolTipText("Marque para lembrar o servidor.");
		
		JButton btnEntrar = new JButton("Entrar");
		btnEntrar.setToolTipText("Clique para fazer login no sistema.");
		GroupLayout gl_panel_4 = new GroupLayout(panel_4);
		gl_panel_4.setHorizontalGroup(
			gl_panel_4.createParallelGroup(Alignment.TRAILING)
				.addGroup(gl_panel_4.createSequentialGroup()
					.addContainerGap(108, Short.MAX_VALUE)
					.addComponent(lblAtosProcessuais)
					.addGap(77)
					.addComponent(button, GroupLayout.PREFERRED_SIZE, 31, GroupLayout.PREFERRED_SIZE))
				.addGroup(gl_panel_4.createSequentialGroup()
					.addContainerGap()
					.addComponent(separator, GroupLayout.DEFAULT_SIZE, 374, Short.MAX_VALUE))
				.addGroup(Alignment.LEADING, gl_panel_4.createSequentialGroup()
					.addGroup(gl_panel_4.createParallelGroup(Alignment.TRAILING)
						.addGroup(gl_panel_4.createSequentialGroup()
							.addContainerGap()
							.addComponent(btnEntrar))
						.addGroup(Alignment.LEADING, gl_panel_4.createSequentialGroup()
							.addGap(48)
							.addGroup(gl_panel_4.createParallelGroup(Alignment.LEADING)
								.addGroup(gl_panel_4.createSequentialGroup()
									.addPreferredGap(ComponentPlacement.RELATED)
									.addComponent(lblEndereoDoServidor)
									.addPreferredGap(ComponentPlacement.RELATED)
									.addComponent(textField))
								.addGroup(gl_panel_4.createParallelGroup(Alignment.TRAILING)
									.addComponent(chckbxLembrar)
									.addGroup(gl_panel_4.createParallelGroup(Alignment.LEADING)
										.addGroup(gl_panel_4.createSequentialGroup()
											.addComponent(lblSenha)
											.addPreferredGap(ComponentPlacement.RELATED)
											.addComponent(textField_1))
										.addGroup(Alignment.TRAILING, gl_panel_4.createSequentialGroup()
											.addComponent(lblLogin)
											.addPreferredGap(ComponentPlacement.RELATED)
											.addComponent(textField_2, GroupLayout.PREFERRED_SIZE, 203, GroupLayout.PREFERRED_SIZE)))))))
					.addContainerGap(47, Short.MAX_VALUE))
		);
		gl_panel_4.setVerticalGroup(
			gl_panel_4.createParallelGroup(Alignment.LEADING)
				.addGroup(gl_panel_4.createSequentialGroup()
					.addGroup(gl_panel_4.createParallelGroup(Alignment.LEADING)
						.addComponent(button)
						.addComponent(lblAtosProcessuais))
					.addPreferredGap(ComponentPlacement.RELATED)
					.addComponent(separator, GroupLayout.PREFERRED_SIZE, 2, GroupLayout.PREFERRED_SIZE)
					.addPreferredGap(ComponentPlacement.RELATED)
					.addGroup(gl_panel_4.createParallelGroup(Alignment.BASELINE)
						.addComponent(lblEndereoDoServidor)
						.addComponent(textField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
					.addPreferredGap(ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
					.addComponent(chckbxLembrar)
					.addPreferredGap(ComponentPlacement.RELATED)
					.addGroup(gl_panel_4.createParallelGroup(Alignment.BASELINE)
						.addComponent(lblLogin)
						.addComponent(textField_2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
					.addPreferredGap(ComponentPlacement.RELATED)
					.addGroup(gl_panel_4.createParallelGroup(Alignment.BASELINE)
						.addComponent(lblSenha)
						.addComponent(textField_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
					.addPreferredGap(ComponentPlacement.RELATED)
					.addComponent(btnEntrar, GroupLayout.PREFERRED_SIZE, 34, GroupLayout.PREFERRED_SIZE)
					.addGap(12))
		);
		gl_panel_4.linkSize(SwingConstants.HORIZONTAL, new Component[] {lblLogin, lblSenha});
		panel_4.setLayout(gl_panel_4);
	}
}
